package com.koron.css2.electronicCred.service.authinfo;

import com.koron.css2.electronicCred.Enum.ProjectTypeEunm;
import com.koron.css2.electronicCred.bean.ElectronicCredRequestBean;
import com.koron.css2.electronicCred.bean.GovServicesRequestBean;
import com.koron.css2.serviceManage.bean.UserInfoBean;
import com.koron.util.GovServicesReqUtils;
import com.koron.util.JsonUtils;
import org.koron.ebs.mybatis.SessionFactory;
import org.springframework.stereotype.Service;
import org.swan.bean.MessageBean;

/**
 * 企业用水授权信息
 *
 * @author 杨嘉慧
 * @date 2023/3/16
 */
@Service("CompWaterAuthInfoService")
public class CompWaterAuthInfoService extends AbstractAuthInfoService {
    @Override
    public MessageBean<?> getAuthInfo(SessionFactory factory, UserInfoBean userInfo, ElectronicCredRequestBean param) throws Exception {
        GovServicesRequestBean gsParam = new GovServicesRequestBean();
        gsParam.setGovServiceId(ProjectTypeEunm.getGovServiceId(param.getProjectType()));
        gsParam.setParam(param.getParam());
        return JsonUtils.jsonToPojo(GovServicesReqUtils
                .doPostToGovServices("/getAuthInfo", gsParam), MessageBean.class);
    }
}
